laravel rename table

72

laravel rename table -

Schema::rename($currentTableName, $newTableName);

migrations required field laravel -

$table->string('foo')->nullable(false)->change();

migration rename column laravel -

php artisan make:migration rename_author_id_in_posts_table --table=posts

migration rename column laravel -

public function up()
{
    Schema::table('posts', function (Blueprint $table) {
        $table->renameColumn('author_ID', 'user_id');
    });
}

rename migration laravel -

php artisan make:migration alter_your_table --table=your_table

Comments

Submit
0 Comments